package com.jiangxiaofei.citycloud.util;

import android.content.Context;

import java.io.File;

import top.zibin.luban.Luban;
import top.zibin.luban.OnCompressListener;

/**
 * Created by Administrator on 2017/9/15 0015.
 */

public class ImageUtils {
    static File mFile=null;
    public static File ImgDo(Context mContext, String path) {
        Luban.with(mContext)
                .load(path)                                   // 传人要压缩的图片列表
                .ignoreBy(100)                                  // 忽略不压缩图片的大小
                .setTargetDir(path)                        // 设置压缩后文件存储位置
                .setCompressListener(new OnCompressListener() {
                    @Override
                    public void onStart() {

                    }

                    @Override
                    public void onSuccess(File file) {
                        mFile=file;
                    }

                    @Override
                    public void onError(Throwable e) {

                    }
                }).launch();    //启动压缩
        return mFile;
    }
}
